package org.skyemoon.hbase.hbasetest.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.skyemoon.hbase.hbasetest.dao.entity.ElectronicDO;
import org.skyemoon.hbase.hbasetest.dao.entity.RadioDO;
import org.skyemoon.hbase.hbasetest.dao.mapper.ElectronicMapper;
import org.skyemoon.hbase.hbasetest.dto.req.FlightImageReqDTO;
import org.skyemoon.hbase.hbasetest.service.ElectronicService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ElectronicServiceImpl extends ServiceImpl<ElectronicMapper, ElectronicDO> implements ElectronicService {

    private final ElectronicMapper electronicMapper;

    @Override
    public void saveElectronicData(List<ElectronicDO> electronicDOList) {
        this.saveBatch(electronicDOList);
    }

    @Override
    public List<ElectronicDO> selectElectronicData(FlightImageReqDTO requestParam) {
        LambdaQueryWrapper<ElectronicDO> queryWrapper = Wrappers.lambdaQuery(ElectronicDO.class)
                .eq(ElectronicDO::getFlightType, requestParam.getFlightType())
                .eq(ElectronicDO::getFlightNum, requestParam.getFlightNum())
                .eq(ElectronicDO::getFlightTask, requestParam.getFlightTask());
        return electronicMapper.selectList(queryWrapper);
    }
}
